package yawning.mew.cat;

import yawning.mew.cat.CatModelSimState.CatTargetData;
import yawning.mew.sim.SimulationEventAction;

public class EventShatteringThrow extends SimulationEventAction {
	CatModelSimState mState;
	private CatTargetData mTargetData;
	private String mTargetName;

	EventShatteringThrow(CatModelSimState state, CatTargetData targetData) {
		super(state.mSimEngine);
		mState = state;
		mTargetData = targetData;
		mTargetName = targetData.getSimulationTarget().getTarget().getName();
	}

	@Override
	public double perform() {
		schedule(mState.mModel.shatteringThrowDebuffDuration);
		mTargetData.setArmorMinorMult(mState.mModel.debuffShatteringThrow);

		if (mState.mIsLogging) mState.mLog.log("Shattering Throw: %s\n", mTargetName);

		return 0.0;
	}

	@Override
	public void onExpire() {

		if (mState.mIsLogging) mState.mLog.log("Shattering Throw: %s Expiration\n", mTargetName);

		mTargetData.setArmorMinorMult(1.0);
	}
}
